<extend name="Layout/ins_page" />
<block name="content">
	{:W('PageHeader/new_search',array('name'=>$folder_name,'search'=>'M'))}
	<form method="post" name="form_adv_search" id="form_adv_search">
		<div class="adv_search panel panel-default <php>echo empty($_REQUEST) ? 'hidden' : '';</php>"  id="adv_search">
			<div class="panel-heading">
				<div class="row">
					<h4 class="col-xs-6">出入库明细查询</h4>
					<div class="col-xs-6 text-right">
						<a  class="btn btn-sm btn-info" onclick="submit_adv_search();">搜索</a>
						<a  class="btn btn-sm btn-info" href="{:U('index')}">重置</a>
					</div>
				</div>
			</div>
			<div class="panel-body">
				<div class="form-group col-sm-6" >
					<label class="col-sm-4 control-label" for="product_type_id">产品类别：</label>
					<div class="col-sm-8">
						<select class="form-control" name="product_type_id">
							<option value="">选择产品类别</option>
							<notempty  name="product_type">
								<foreach name="product_type" item="vo">
									<option value="{$vo['id']}" <if condition="$product_type_id eq $vo['id']">selected="selected"</if>  >{$vo['type_name']}</option>
								</foreach>						
							</notempty >
						</select>
					</div>
				</div>
				<div class="form-group col-sm-6">
					<label class="col-sm-4 control-label" for="content">产品名称：</label>
					<div class="col-sm-8">
						<input class="form-control" id="product_name" type="text" name="product_name" value="{$product_name}"/>
						<!-- 
						<select class="form-control" name="product_id">
							<option value="">选择产品名称</option>
							<foreach name="product" item="vo">
								<option value="{$vo.id}" <if condition="$product_id eq $vo['id']">selected="selected"</if>>{$vo.product}</option>
							</foreach>
						</select>
						 -->
					</div>
				</div>
				<div class="form-group col-sm-6" ff="{$search}">
					<label class="col-sm-4 control-label" for="type">出入库：</label>
					<div class="col-sm-8">
						<select class="form-control" name="type">
							<option value="">选择出入库</option>
							<option value="1" <if condition="1 eq $type">selected="selected"</if>>入库</option>
							<option value="2" <if condition="2 eq $type">selected="selected"</if>>出库</option>
						</select>
					</div>
				</div>
			</div>
		</div>
	</form>
	<div class="space-8"></div>
	<div class="operate panel panel-default">
		<div class="panel-body">
			<div class="pull-right">
				<if condition="$auth['write']">
					<a class="btn btn-sm btn-primary" href="{:U('addProduct')}">新建</a>
					<a class="btn btn-sm btn-primary" href="{:U('inc')}">入库</a>
					<a class="btn btn-sm btn-primary" href="{:U('dec')}">成品出库</a>
					<a class="btn btn-sm btn-primary" href="{:U('halfdec')}">半成品出库</a>
				</if>
			</div>
		</div>
	</div>
	<div class="ul_table ul_table_responsive">
		<ul>
			<li class="thead">
				
					<span class="col-8">产品名称</span>
					<span class="col-8">产品类别</span>
					<span class="col-8">分类</span>
					<span class="col-8">产品编号</span>
					<span class="col-10">出/入库数量</span>
					<span class="col-10">出/入库类型||状态</span>
					<span class="col-10">操作时间</span>
				
					<span class="col-10">摘要</span>
					<span class="col-6">操作</span>

			</li>
			<empty name="list"> 
				<li class="no-data">
					没找到数据
				</li>
				<else/>
				<foreach name="list" item="vo">
					<li class="tbody">
							<span class="col-8">{$vo.product_name}</span>
							<span class="col-8">{$vo.product_type_name}</span>
							<span class="col-8"><php>echo empty($flag[$vo['flag']]) ? '' : $flag[$vo['flag']];</php></span>
							<span class="col-8">{$vo.product_bh|default='无'}</span>
							<span class="col-10">{$vo.number}<if condition=" ($vo['type'] eq 2) AND ($vo['operate_number'] !=0 ) AND ($vo['convert_unit'] !='')">/{$vo.operate_number}{$vo.convert_unit}</if></span>
							<span class="col-10 ">
							    <if condition="$vo.type eq 1"> 入库
							    <elseif condition="$vo.type eq 2"/>出库
							    </if>||
							    <if condition="$vo.status eq 1"> 成功
							    <elseif condition="$vo.status eq 2"/>待审核
							    <elseif condition="$vo.status eq 3"/>拒绝
							    </if>
							</span>
							<span class="col-10">
								{$vo.create_at|substr=0,10}
							</span>
						
							<span class="col-10">
								<eq name="vo.remark" value="">
									无
								<else />
									{$vo.remark}
								</eq>							
							</span>
							<span class="col-6 col-sm-end">
								<a href="{:U('read','id='.$vo['id'])}">查看</a>&nbsp;
								<if condition="$auth['write']">
									<a href="{:U('delete','id='.$vo['id'])}" >删除</a>
							    </if>
							</span>
						</>
					</li>
				</foreach>
				<div class="pagination">
					{$page}
				</div>
			</empty>
		</ul>
	</div>
</block>